import request from "@/utils/request";
// 请求用户列表
export const reqUserList = (page, limit, searchParams) => {
  return request.get("/admin/acl/user" + `/${page}/${limit}`, {
    params: searchParams
  });
};
// 添加或者修改的api
export const reqSaveOrUpdateUser = user => {
  if (user.id) {
    return request.put("/admin/acl/user/update", user);
  }
  return request.post("/admin/acl/user/save", user);
};
//删除单个用户
export const reqRemoveUser = id => {
  return request.delete("/admin/acl/user/remove" + `/${id}`);
};
//批量删除
export const reqRemoveUsers = ids => {
  return request.delete("/admin/acl/user/batchRemove", { data: ids });
};
//获取用户角色列表
export const reqUserRoleList = userId => {
  return request.get("/admin/acl/user/toAssign" + `/${userId}`);
};

// 给用户分配角色
export const reqAssignUserRoleList=(userId,roleId)=>{
  return request.post('/admin/acl/user/doAssign',null,{
    params:{
      userId,
      roleId
    }
  })
}
